import { FormOptions } from "@/components/CustomForm/type";

export const useForm = () => {
  const createModel = (meta: FormOptions[]) => {
    const formModel = reactive<Record<string, unknown>>({});

    // 依据meta，创建 model
    meta.forEach((item) => {
      formModel[item.prop as string] = item.value;
    });
    return formModel;
  };
  return { createModel };
};
